<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style type="text/css">
			#canvas{
				display: block;
				margin: 0 auto;
				box-shadow: 0 0 10px rgba(0,0,0,0.5);
			}
		</style>
	</head>
	<body>
		<canvas id="canvas"></canvas>
		<script src="../libs/utils.js"></script>
		<script type="text/javascript">
			var canvas = document.querySelector('#canvas')
			var ctx = canvas.getContext('2d');
			
			
			var w = canvas.width = 500;
			var h = canvas.height = 300
			
			// 获取鼠标到canvas的距离
			var pos = $C.getOffset(canvas)
			canvas.addEventListener('click',function(){
				console.log('鼠标到canvas的距离:',pos);
			})
			
		</script>
	</body>
</html>
